package com.zyasdk.util.net;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkUtil {
	
	/**
	 * 判断是否有网络
	 * 
	 * @return
	 */
	public boolean goodNet(Context context) {
		try {
			ConnectivityManager manager = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
			NetworkInfo networkinfo = manager.getActiveNetworkInfo();
			if (networkinfo == null || !networkinfo.isAvailable())
				return false;
			else
				return true;
		} catch (Exception ex) {
			return false;
		}
	}

}
